if test -n "$XDG_STATE_HOME" -a -f "$XDG_STATE_HOME/nix/profile/share/nix-direnv/direnvrc"; then
  source "$XDG_STATE_HOME/nix/profile/share/nix-direnv/direnvrc"
elif test -f "$HOME/.local/state/nix/profile/share/nix-direnv/direnvrc"; then
  source "$HOME/.local/state/nix/profile/share/nix-direnv/direnvrc"
elif test -f "$HOME/.nix-profile/share/nix-direnv/direnvrc"; then
  source "$HOME/.nix-profile/share/nix-direnv/direnvrc"
fi
